<?php require_once('Connections/connect.php'); ?>
<?php 
if(isset($_POST['sblogin'])) 
{ 
	if($_POST['tenthanhvien'] == NULL) 
	{ 
	 echo "Please enter your username<br />"; 
	 } 
	 else
	 { 
	  $u=$_POST['tenthanhvien']; 
	 } 
	 if($_POST['matkhau'] == NULL) 
	 { 
	  echo "Please enter your password<br />"; 
	 } 
	 else
 { 
  $p=$_POST['matkhau']; 
 } 
 if($u && $p) 
 { 
  mysql_select_db("doan",$connect); 
 $sql="select * from user where tenthanhvien='".$u."' and matkhau='".$p."'"; 
  $query=mysql_query($sql); 
 if(mysql_num_rows($query) == 0) 
  { 
  echo "Username or password is not correct, please try again"; 
  } 
  else
  { 
   $row=mysql_fetch_array($query); 
   session_start(); 
  session_register("mathanhvien"); 
 $_SESSION['mathanhvien'] = $row[mathanhvien]; 

   
  } 
 } 
} 
	?> 
 
  <form action="index.php" method="post" name="form_login" id="form_login">
 
<table width="100%" border="0" cellspacing="1" cellpadding="1">
  <tr>
    <td>Tài khoản:</td> 
     <td> <input name="txttv" type="text" alue="tài khoản" size="20"/> </td>
  </tr>
  <tr><td>Mật khẩu:</td>  	
    <td> <input name="txtmk" type="password" size="20"/></td></tr>
  <tr><td></td>
  	<td>  <input class="button_login" type="submit" name="Submit" value="Đăng nhập" /></td>
  </tr>
 
</table>
 
  </form>
</div>
